#!/usr/bin/env python 

from twisted.web import server,resource
from twisted.internet import reactor,endpoints

class Counter(resource.Resource):
    isLeaf=True 
    numberRequests=0
    
    def render_GET(self,request):
        self.numberRequests+=1
        request.setHeader('content-type','text/plain')
        return "I am request "+str(self.numberRequests)+"\n"

endpoints.serverFromString(reactor,"tcp:9090").listen(server.Site(Counter()))
reactor.run()